<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>个人存款计算器</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="css/mui.css" rel="stylesheet" />
		<link rel="stylesheet icon" type="href="img/logo.png"/>
		<script scr="js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
		<script scr="js/bootstrap.min.js" type="text/scriptlet" charset="utf-8" ></script>
		<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"/>
		<script type="text/javascript">
			function cale(){
				num1=$("#num1").val();
				regExp=/^[0-9]{1,8}$/;
				if(!regExp.test(num1)){
					$("#num1").val("必须是1-8的数字").css("color","red");
				}
				number1=parseInt(num1);
				year1=$("#year option:selected").text()
				if(year1=="三年"){
					num2=$("#year").val()*number1*3;
				}
				if(year1=="四年"){
					num2=$("#year").val()*number1*4;
				}
				if(year1=="二年"){
					num2=$("#year").val()*number1*2;
				}
				if(year1=="一年"){
					num2=$("#year").val()*number1;
				}
				
				$("#num2").val(num2);
				total=number1+num2;
				$("#num3").val(total);
			}
			function clearNum1(){
				$("#num1").val("").css("color","");
			}
			</script>
		
	</head>
	<body>
		
		<div style="width: 50%;" class="text-center center-block">
			<div><img src="img/cmb.png" ></div>
				<!-- 表格 -->
				<table class="table table-bordered" border="" cellspacing="" cellpadding="">
					<tr class="bg-primary">
						<td colspan="2">个人存款计算</td>
					</tr>
					<!-- tr行 td列-->
					<tr>
						<td class="text-right">存款金额</td>
						<td>
							<input onfous="clearNum1()" class="form-control" type="text" name="" id="num1" value="" />
						</td>
					</tr>
					<tr>
						<td class="text-right">存款期限</td>
						<td>
							<select class="form-control" id="year">
								<option value ="0.0175">一年</option>
								<option value ="0.0225">两年</option>
								<option value ="0.0275">三年</option>
								<option value ="0.0275">四年</option>
							</select>
						</td>	
					</tr>
					<tr>
						<td class="text-right">所得利息</td>
						<td>
							<input class="form-control" type="text" name="" id="num2" value="" />
						</td>	
					</tr>
					<tr>
						<td class="text-right">本息合计</td>
						<td>
							<input readonly="readonly" class="form-control" type="text" name="" id="num3" value="" />
						</td>	
					</tr>
					<tr>
						<!-- button按钮 -->
						<td colspan="2">
							<button onclick="cale()" class="btn btn-primary btn-block" type="button">开始计算</button>
						</td>	
					</tr>
				</table>
				<div id="">开发者:182055242 邵 蕊</div>
			</div>
	</body>
</html>
